package com.coffee.utils;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

//InitializingBean  当项目启动，Spring接口，Spring加载之后，执行接口的方法
@Component
public class ContantPropertiesUtils implements InitializingBean{
    @Value("${aliyun.oss.file.endpoint}")
    private String endpoint;
    @Value("${aliyun.oss.file.keyid}")
    private String keyid;
    @Value("${aliyun.oss.file.keysecret}")
    private String keysecret;
    @Value("${aliyun.oss.file.bucketname}")
    private String bucketname;

    //定义静态的公开常量
    public static String END_POINT;
    public static String KEYID;
    public static String KEYSECRET;
    public static String BUCKETNAME;
    @Override
    public void afterPropertiesSet() throws Exception {
        END_POINT=endpoint;
        KEYID=keyid;
        KEYSECRET=keysecret;
        BUCKETNAME=bucketname;
    }
}
